<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge" />
	<title>扫码变身萌蠢萌蠢的机器人小素</title>
	<link rel="stylesheet" href="" />
	<style type="text/css" media="screen">
		.main{
    		text-align: center; /*让div内部文字居中*/
    		background-color: #fff;
   	 		border-radius: 20px;
			width: 450px;
    		height: 450px;
    		margin: auto;
    		position: absolute;
    		top: 0;
    		left: 0;
    		right: 0;
    		bottom: 0;
		}
	</style>
	<script type="text/javascript" src="/js/jquery.min.js"></script>
</head>
<body>
	<div class="main" style="text-align: center; border: green solid 1px;">
		<img alt="扫码登录" th:src="${codeImg}" style="margin: 0 auto;" />

		<input type="hidden" id="uuid" th:value="${uuid}" />
		<div id="msg"></div>
	</div>
</body>
</html>
<script>
var t = setTimeout('login()',1000);
var uuid = $('#uuid').val();
console.log("uuid:"+uuid);
function login(){
	if(uuid != '' && uuid != undefined){
		console.log("进入登录等待...");
		clearTimeout(t);
		$.post('/wxlogin',{uuid:uuid},function(data){
			if(data.code=="0"){
				console.log(data.message);
				$('#msg').html(data.message);
			}
		});
	}else{
		t = setTimeout('login()',1000);
		console.log("uuid 为空");
	}
}


var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?66eb41787f05b9755f31623b0d2a8d6e";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();


</script>